<script type="text/javascript">
$(function() {
	{if IS_POST}
	dr_tips("{fc_lang('操作成功')}", 3, 1);
	{/if}
	// 单击事件
	$(".dr_index").click(function(){
		if ($(this).prop('checked')) {
			$(this).nextAll(".dr_orther").attr("disabled",false);
		} else {
			$(this).nextAll(".dr_orther").attr("disabled",true);
		}
	});
	// 初始化
	$(".dr_index").each(function(){
		if ($(this).prop('checked')) {
			$(this).nextAll(".dr_orther").attr("disabled",false);
		} else {
			$(this).nextAll(".dr_orther").attr("disabled",true);
		}
	});
	document.onkeydown = function(e){  //防止回车提交表单
		var ev = document.all ? window.event : e;
		if (ev.keyCode==13) {
			$("#mark").val("1"); // 标识不能提交表单
		}
	}
});
function dr_auth_selected(_class) {
	if ($("#dr_"+_class).prop('checked')) {
		$(".dr_"+_class).attr("checked",true);
	} else {
		$(".dr_"+_class).attr("checked",false);
	}
	$(".dr_"+_class).each(function(){
		if ($(this).prop('checked')) {
			$(this).nextAll(".dr_orther").attr("disabled",false);
		} else {
			$(this).nextAll(".dr_orther").attr("disabled",true);
		}
	});
}
function dr_form_check() {
	if ($("#mark").val() == 0) { 
		return true;
	} else {
		return false;
	}
}
</script>
<style>
.menu_qx {
	width:10px;
}
.menu_gx {
	width:120px;
}
</style>
<form action="" method="post" name="myform" id="myform" onsubmit="return dr_form_check()">
<input name="mark" id="mark" type="hidden" value="0">
<div class="subnav">
	<div class="table-list">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tbody>
        {loop $list $c $t}
        <tr>
            <td align="right"><input type="checkbox" class="dr_{$c}" id="dr_{$c}" onClick="dr_auth_selected('{$c}')"></td>
            <td align="left">{$t['name']}</th>
            <td align="left">
            {loop $t['auth'] $uri $name}
            <input type="checkbox" class="dr_{$c} {if strrchr($uri, 'index')=='index'} dr_index{else} dr_orther{/if}" name="data[]" value="{$prefix}{$uri}" {if @in_array($prefix.$uri, $data)}checked="checked"{/if}>&nbsp;{$name}&nbsp;&nbsp;&nbsp;
            {/loop}
            </td>
        </tr>
        {/loop}
		<tr>
            <td align="center" colspan="3" style="color:red;"><b>{fc_lang('程序名称')}</b></td>
        </tr>
        </tbody>
        </table>
	</div>
</div>
</form>